//
//  DHHomeViewController.m
//  DHWeibo
//
//  Created by donghai on 15/12/6.
//  Copyright © 2015年 东海. All rights reserved.
//

#import "DHHomeViewController.h"
#import "UIBarButtonItem+Extension.h"
#import "DHTwoViewController.h"
#import "DHTitleButton.h"
#import "DHPopController.h"

@interface DHHomeViewController ()

@end

@implementation DHHomeViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    //设置导航条左两边按钮
    self.navigationItem.leftBarButtonItem = [UIBarButtonItem barBtnItemWithNmlImg:@"navigationbar_friendsearch" hltImg:@"navigationbar_friendsearch_highlighted" target:self action:@selector(friendsearchBtnClick)];
    //设置导航条右两边按钮
    self.navigationItem.rightBarButtonItem = [UIBarButtonItem barBtnItemWithNmlImg:@"navigationbar_pop" hltImg:@"navigationbar_pop_highlighted" target:self action:@selector(qrcScan)];
    
    self.title = @"首页";
    //添加按钮到导航栏中间
    DHTitleButton *titleBtn = [DHTitleButton buttonWithType:UIButtonTypeCustom];
    titleBtn.bounds = CGRectMake(0, 0, 100, 30);
    [titleBtn setTitle:@"创智博客" forState:UIControlStateNormal];
    //添加点击事件
    [titleBtn addTarget:self action:@selector(titleBtnClick:) forControlEvents:UIControlEventTouchUpInside];
    self.navigationItem.titleView = titleBtn;
}
#pragma MARK: - 标题按钮点击
-(void)titleBtnClick:(DHTitleButton *)btn
{
    UIView *contentView = [[UIView alloc] init];
    contentView.bounds = CGRectMake(0, 0, 150, 200);
    contentView.backgroundColor = [UIColor redColor];
    //初始化popControl
    DHPopController *popControl = [[DHPopController alloc] initWithContentView:contentView];
    //展现
    [popControl showInView:btn];
}
-(void)friendsearchBtnClick{
    MethodLog
    DHTwoViewController *twoVc = [[DHTwoViewController alloc] init];
    [self.navigationController pushViewController:twoVc animated:YES];
}


-(void)qrcScan{
    NSLog(@"%s",__func__);
}

@end
